<template>
  <!--学习-->
  <div class="admin-web-conclusion-list">
    <w-nav-search-bar
      @change="topBarClick"
      @search="searckBtnClick"
      :options="searchBarOptions"
      :class-model="classModel"/>
    <!--列表数据-->
    <w-cell
      v-for="(v, k) in loadListModel.dataArr"
      :item="v"
      :key="k"
      @reload="reloadData"/>
    <!--底部加载更多-->
    <w-load-more :load-model="loadListModel"/>
  </div>
</template>

<script>
  import StudyModel from '@/models/web/StudyModel'
  import YBListLoad from '@/models/YBListLoad'
  import WLoadMore from '@/components/global/loadMore/index'
  import WNavSearchBar from '@/pages/pc/com/nav/typeAndSelKey'
  import WCell from './cell'
  export default {
    name: 'WebConclusion',
    components: {
      WLoadMore,
      WCell,
      WNavSearchBar
    },
    data() {
      return {
        /**
         * 列表加载模型
         */
        loadListModel: new YBListLoad(StudyModel, { type: '' }),
        /**
         * 查找对象
         */
        search: {
          key: null,
          type: '0'
        },
        /**
         * 类模型
         */
        classModel: StudyModel,
        /**
         * 搜索框数组
         */
        searchBarOptions: ['所有', '标题', '描述', '内容']
      }
    },
    methods: {
      /**
       * 顶部导航栏点击
       */
      topBarClick(e) {
        const key = e.label === '全部' ? '' : e.label
        this.loadListModel.otherData.type = key
        this.reloadData()
      },
      /**
       * 重新加载数据
       */
      reloadData() {
        this.loadListModel.clearData()
        this.loadListModel.loadData()
      },
      /**
       * 查找按钮点击
       * @param type 查找类型
       * @param key 查找的关键字
       */
      searckBtnClick(key, type) {
        this.loadListModel.otherData.searchType = type
        this.loadListModel.otherData.searchKey = key
        this.reloadData()
      }
    }
  }
</script>

<style lang="scss" scoped>
  .admin-web-conclusion-list {

  }
</style>

